,<template>
  <div>
    <table id="tb">
      <tr>
        <th>编号</th>
        <th>品牌名称</th>
        <th>创建时间</th>
        <th>操作</th>
      </tr>
      <tr v-for="(obj, index) in arr" :key="index">
        <td>{{ obj.id }}</td>
        <td>{{ obj.name }}</td>
        <td>{{ obj.date }}</td>
        <td><button @click="delFn(index)">删除</button></td>
      </tr>
      <tr v-if="arr.length === 0">
        <td colspan="4">没有数据了</td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [
        {
          id: 1,
          name: "宝马",
          date: "2020-08-01",
        },
        {
          id: 2,
          name: "奔驰",
          date: "2020-08-02",
        },
        {
          id: 3,
          name: "奥迪",
          date: "2020-08-03",
        },
      ],
      isShow: false,
    };
  },
  methods: {
    delFn(index) {
      this.arr.splice(index, 1);
    },
  },
};
</script>

<style lang="less">
#tb {
  border-collapse: collapse;
  border: 1px solid #333;
  width: 600px;

  tr {
    th {
      border: 1px solid #333;
      background: pink;
    }
    td {
      text-align: center;
      border: 1px solid #333;
    }
  }
}
</style>